package com.dongni.tools;

import android.os.Build;
import android.text.Html;
import android.text.Spanned;

/**
 * html工具类
 * @autor hongbing
 * @date 2018/9/27
 */
public final class HtmlUtils {

    /**
     * 字符串支持html标签
     * @param str
     * @return
     */
    public static Spanned htmlFormat(String str) {
        Spanned result;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            result = Html.fromHtml(str, Html.FROM_HTML_MODE_LEGACY);
        } else {
            result = Html.fromHtml(str);
        }
        return result;
    }


}
